﻿@model NOSDC.Pocos.Sponsor

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/ckeditor/ckeditor.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Uploadify/swfobject.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Uploadify/jquery.uploadify.v2.1.4.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#file_upload').uploadify({
            'uploader': '/scripts/uploadify/uploadify.swf',
            'script': '/Admin/Sponsor/UploadSponsorLogo',
            'cancelImg': '/scripts/uploadify/cancel.png',
            'folder': '/Images/Spnsors',
            'buttonText': 'Sponsor Logo',
            'multi': false,
            'auto': true,
            'fileExt': '*.jpg;*.gif;*.png;*.jpeg;',
            'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG)',
            'onComplete': function (event, ID, fileObj, response, data) {
                debugger;
                $(".success").html(response).fadeIn('slow');
                $("#Logo").val(fileObj.name);
            }
        });
    });
</script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Update a Sponsor</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
                
        <div class="editor-label">
            <strong>@Html.LabelFor(model => model.Link)</strong>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Link)
            @Html.ValidationMessageFor(model => model.Link)
        </div>

        <div class="editor-label" style="clear: both;">
            <strong>@Html.LabelFor(model => model.Description)</strong> * <span style="color: green;
                font-style: italic; text-decoration: underline;">Be careful adding HTML to the page.
                Make sure you check the affected pages to ensure that your html did not break any
                layouts.</span>
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Description, new { @class = "ckeditor", style = "width:620px;height:150px;", id = "editor1", name = "Story" })
            @Html.ValidationMessageFor(model => model.Description)
        </div>
        <br />
        <input id="file_upload" type="file" name="file_upload" /> <span class="success" style="display:none;color:green; font-weight: bold;">File uploaded!</span>
        <br /> <br />
        <div class="editor-field">
            @Html.HiddenFor(model => model.Logo)
        </div>
        <div class="editor-field">
            @Html.CheckBoxFor(model => model.FrontPageSponsor) <strong>Add as a primary sponsor.</strong>
            <span style="font-style: italic;">*Note: this will be added to the Sponsors section
                on the front page.</span>
            @Html.ValidationMessageFor(model => model.FrontPageSponsor)
        </div>
        @Html.HiddenFor(model => model.SponsorId)
        <p>
            <input type="submit" value="Update" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

